home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
map
/
avail.arc
/
GETDIRHD.ASM
< prev
Wrap
Assembly Source File
|
1987-08-06
|
2KB
|
66 lines
;*****************************************************************************
; GetDirectoryHandle -- gets the directory handle and status flags
; associated with a drive number
;
; Input: BYTE driveNumber; /* The drive number for which the
; drive handle and status flags should
; be returned (0=A, 1=B, etc.) */
; BYTE *driveHandle; /* Pointer to the byte where the drive
; handle associated with the specified
; drive letter should be returned (OPT)*/
; BYTE *statusFlags; /* Pointer to the byte where the status
; flags associated with the specified
; drive letter should be returned (OPT)*/
;
; Output: Returns a 0 in ax if successful or an 0xFF in ax if the specified
; drive letter is not mapped to a path.
;
;****************** ASSUMING SMALL MODEL FOR LATTICE C V2.15 ***************
driveNumber EQU byte PTR 4[bp]
handle EQU word PTR 6[bp]
status EQU word PTR 8[bp]
PGroup GROUP Prog
Prog SEGMENT byte public 'PROG'
ASSUME cs:PGroup
PUBLIC GetDirectoryHandle
GetDirectoryHandle PROC NEAR
push bp ;Save old frame pointer
mov bp, sp ;Set our frame pointer to current stack pointer
mov ax, 0e900h ;Function E9h - "Get Directory Handle"
mov dh, 0 ;DH always 0
mov dl, driveNumber
int 21h ;Let DOS/Shell handle request
push si ;Save SI
mov si, word ptr handle ;
or si, si ;Check if handle==NULL
jz no_handle ; yes, then handle is not wanted
mov [si], al ; no, then fill in handle
no_handle:
mov si, word ptr status ;
or si, si ;Check if Status==NULL
jz no_status ; yes, then status is not wanted
mov [si], ah ; no, then fill in status
no_status:
pop si ;Restore SI
cmp ah, 0 ;If AH==0, then drive NOT mapped
mov ax, 0 ;otherwise, drive IS mapped
jnz MappingExists
mov ax, 0ffh
MappingExists:
pop bp
ret
GetDirectoryHandle ENDP
Prog ENDS
END